package com.slz3.business.module.socialManagement.socLife.domain;

import com.slz3.business.frame.enums.AuditFlag;
import com.slz3.business.frame.enums.UsingFlag;
import com.slz3.business.frame.util.UUIDUtils;
import com.slz3.business.frame.util.VE;

import java.time.LocalDateTime;

public class SocLifeFactory {

    /**
     * 初始化基础属性值
     */
    public static SocLife initBaseFields(SocLife socLife) {
        if (socLife.getUuid() == null) {
            socLife.setUuid(UUIDUtils.generateUUID());
            socLife.setCreateTime(LocalDateTime.now());
            if (VE.isEmpty(socLife.getSerAudit())) {
                socLife.setSerAudit(AuditFlag.WAIT_SUBMIT);
            }
            if (VE.isEmpty(socLife.getSerUsing())) {
                socLife.setSerUsing(UsingFlag.ENABLE);
            }
        } else {
            socLife.setLastModifyTime(LocalDateTime.now());
        }
        return socLife;
    }

    /**
     * 初始化基础属性值
     */
    public static SocLife initBaseFields() {
        return initBaseFields(newTemStyle());
    }

    public static SocLife newTemStyle() {
        return new SocLife();
    }

}
